package com.foton.designmodel.decorator.impl;


import com.foton.designmodel.decorator.orderprice.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * 满减逻辑实现类：满100金额，减10块
 */
@Slf4j
@Component("fullMoneySum")
public class FullMoneySum  extends DecoratorMoneySum{


    @Override
    public Order money(Order order) {
        super.money(order);
        fullSum(order);
        return order;
    }

    //满减逻辑实现类：满100金额，减10块
    private void fullSum(Order order) {
        if(order.getPayMoney()>=100){
            order.setAcutMoney(order.getPayMoney()-10);
        }
        log.info("订单参加【满减活动】的结算金额 {}",order);
    }


}
